package net.FamilyTree.util;

import net.FamilyTree.vo.ResultVo;

/**
 * ResultVo工具类
 * 用于创建ResultVo对象的辅助工具类
 */
public class ResultVoUtil {
    /**
     * 创建成功的ResultVo对象
     *
     * @param object 返回的数据对象
     * @return ResultVo对象
     */
    public static ResultVo success(Object object) {
        ResultVo resultVo = new ResultVo<>();
        resultVo.setCode(0);
        resultVo.setData(object);
        return resultVo;
    }

    /**
     * 创建失败的ResultVo对象
     *
     * @return ResultVo对象
     */
    public static ResultVo fail() {
        ResultVo resultVo = new ResultVo<>();
        resultVo.setCode(-1);
        return resultVo;
    }
}
